package greed;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class ShortestPath2 {
    
    static InOut6 io = new InOut6();
    static final int MAX_WEIGHT = 0x0000ffff; // 表示无穷大的值
    int vertexCount;
    int edgeCount;
    int[][] graph;
    

    private ShortestPath2(int vertexCount, int edgeCount, int[][] graph) {
        super();
        this.vertexCount = vertexCount;
        this.edgeCount = edgeCount;
        this.graph = graph;
    }

    /*
    
    floyd算法用于解决多源最短路径问题。
    单源最短路径指的是从一个源节点出发，计算到其他所有节点的最短路径。
    也就是说，在单源最短路径问题中，只需要确定一个起点，然后计算该起点到图中所有其他节点的最短距离。
    多源最短路径则是在图中计算任意两个节点之间的最短路径。
    换言之，需要求解所有可能的起点和终点之间的最短路径。
    
    
    
    
     */
    public void floyd() {
        
    }


    public static void main(String[] args) {
        int vertexCount = io.nextInt();
        int edgeCount = io.nextInt();
        int[][] graph = new int[vertexCount][vertexCount];
        for (int i = 0; i < vertexCount; i++) {
            for (int j = 0; j < vertexCount; j++) {
                if (i != j) {
                    graph[i][j] = MAX_WEIGHT;
                }
            }
        }
        for (int i = 0; i < edgeCount; i++) {
            graph[io.nextInt()][io.nextInt()] = io.nextInt();
        }
        ShortestPath2 s = new ShortestPath2(vertexCount, edgeCount, graph);
        io.out.flush();
    }

}
class InOut6 {
    BufferedReader br;
    StringTokenizer tok;
    PrintWriter out;
    InOut6() {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
    }
    public boolean hasNext() {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                return false;
            }
        }
        return true;
    }
    public String next() {
        if (hasNext()) {
            return tok.nextToken();
        }
        return null;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
}

